package cn.bobohost.crmrbac.service.impl;

import cn.bobohost.crmrbac.pojo.po.Permission;
import cn.bobohost.crmrbac.dao.mapper.PermissionMapper;
import cn.bobohost.crmrbac.pojo.query.QueryObject;
import cn.bobohost.crmrbac.service.PermissionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 波波老师
 * @since 2025-05-21
 */
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements PermissionService {

    //注入权限dao
    private final PermissionMapper permissionMapper;

    @Override
    public PageInfo<Permission> selectPermissionListPage(QueryObject queryObject) {

        PageHelper.startPage(queryObject.getCurrentPage(),queryObject.getPageSize());

        //查询列表
        List<Permission> permissionList = permissionMapper.selectList(null);

        return new PageInfo<Permission>(permissionList);
    }
}
